package org.Keks.graphics;

import java.awt.image.BufferedImage;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferInt;

/**
 * The Screen class is more or less the heart of the engine.
 * If you want to render something on screen then you will have to use an instance of this class.
 * @author kevin
 *
 */
public class KeksScreen extends KeksBitmap {
	public BufferedImage image;
	private int xOffset, yOffset;

	public KeksScreen(int w, int h) {
		super(w, h);
		image = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
		pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
	}

	public void setOffset(int xOffset, int yOffset) {
		this.xOffset = xOffset;
		this.yOffset = yOffset;
	}

	public void blit(KeksBitmap bitmap, double x, double y) {
		super.blit(bitmap, (int) x, (int) y);
	}

	public void blit(KeksBitmap bitmap, int x, int y) {
		super.blit(bitmap, x + xOffset, y + yOffset);
	}

	public void blit(KeksBitmap bitmap, int x, int y, int w, int h) {
		super.blit(bitmap, x + xOffset, y + yOffset, w, h);
	}

	public void colorBlit(KeksBitmap bitmap, double x, double y, int color) {
		super.colorBlit(bitmap, (int) x, (int) y, color);
	}

	public void colorBlit(KeksBitmap bitmap, int x, int y, int color) {
		super.colorBlit(bitmap, x + xOffset, y + yOffset, color);
	}
}